<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
var jsonObj=new Object();
$(function(){
	$("#schedulequeryListBtn").click();
	//$("#searchButton").click();
	
	$("#dialogDiv").dialog({
		title:"系统邮件",//标题
		width: 770,//宽度
	    height: 460,//高度
	    top:35,
	    closed: true,//初始关闭
	    cache: false,//缓存
	    modal: true,
	    onClose: function() {
			 $("#dialogIframe").attr("src","");
			} 
	});
	
	$("#mailSystemButton").click(function(){
		var checkedObj = $("input[name='studentId']:checked");
		if(checkedObj.size()==1){
			var studentId = checkedObj.val();
			$("#dialogIframe").attr("src","mailSystemAdd.action?studentId="+studentId);
			$("#dialogDiv").dialog('open');
		}else{
			$.messager.alert("提示","选一个");
		}
	});
	
	
	$("#searchButton").click(function(){
		var cnName = $("#cnName").val();
		$('#peopleInformation').datagrid({
		    url:'<c:url value="peopleInformation.action"/>',//用户控制器里
		    queryParams:{cnName:cnName},//提交参数
		    toolbar:'#carCategoryToolbar',//表头工具栏
		    pagination:true,//显示分页  
		    pagePosition:'bottom',//分页栏出现位置
		    pageNumber:1,//初始页码
		    pageSize:10,//初始每页显示记录数量
		    pageList:[10, 20, 30, 40], 
		    fitColumns:true,
		    //checkOnSelect:true,
		    selectOnCheck:false,
		    sortName: 'userName',
		    sortOrder: 'asc',
		    remoteSort: false,
		    singleSelect:false,
		    //fitColumns:false,
		    //multiSort:true,
		    rownumbers:true,
		    //checkOnSelect:true,
		    striped:true,
		    //singleSelect:false,
		    //singleSelect:true,
		    columns:[[
				{field:'studentId',title:'',formatter: function(value,row,index){
					return '<input name="studentId" type="checkbox" value="'+value+'" />';
				}},
				{field:'userName',title:'学号',width:100,align:'center',sortable:true},
				{field:'cnName',title:'名字',align:'center',width:100},
				{field:'college',title:'学院',align:'center',width:150},
				{field:'theClass',title:'班级',align:'center',width:100},
		    ]],
		   onClickRow:function(index,row){
		    $("input[type=checkbox]").val([row.studentId]).attr("checked",true);
		    }
		});
	});
	
	$("#empty").click(function(){
		$("#cnName").textbox('setValue','');
		$("#searchButton").click();
	});
});

function closeDialog(){
	var storiedBuilding = $("#storiedBuilding").val();
	//$('#peopleRecordList').datagrid({ queryParams:{storiedBuilding:storiedBuilding}});
	$('#dialogDiv').dialog('close');
}

